package com.shequan.demo.dao.impl;

import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.shequan.demo.bean.pojo.DemoUserInfo;
import com.shequan.demo.dao.DemoDAO;
/**
 * 当持久层中需要特殊化处理时需要自己写接口实现类，否则直接使用DAO接口即可。
 * <P>
 * Copyright 2012 shequaner.
 * All Rights Reserved.
 * @author Liust
 * @version 1.0, 2012-2-21
 * @see com.shequan.demo.dao.impl.DemoDAOImpl 
 * @since 1.0
 */
public class DemoDAOImpl extends SqlSessionDaoSupport implements DemoDAO{

	public int deleteByPrimaryKey(Integer userId) {
		return getSqlSession().delete("com.shequan.demo.dao.DemoDAO.deleteByPrimaryKey", userId);
	}

	public int insert(DemoUserInfo record) {
		return getSqlSession().insert("com.shequan.demo.dao.DemoDAO.insert", record);
	}

	public int insertSelective(DemoUserInfo record) {
		return getSqlSession().insert("com.shequan.demo.dao.DemoDAO.insertSelective", record);
	}

	public DemoUserInfo selectByPrimaryKey(Integer userId) {
		return (DemoUserInfo)getSqlSession().selectOne("com.shequan.demo.dao.DemoDAO.selectByPrimaryKey", userId);
	}

	public List<DemoUserInfo> selectAllUsers() {
		return getSqlSession().selectList("com.shequan.demo.dao.DemoDAO.selectAllUsers");
	}

	public int updateByPrimaryKeySelective(DemoUserInfo record) {
		return getSqlSession().update("com.shequan.demo.dao.DemoDAO.updateByPrimaryKeySelective",record);
	}

	public int updateByPrimaryKey(DemoUserInfo record) {
		return getSqlSession().update("com.shequan.demo.dao.DemoDAO.updateByPrimaryKey",record);
	}

	public DemoUserInfo selectUserByUserNameAndUserPwd(DemoUserInfo record) {
		return (DemoUserInfo)getSqlSession().selectOne("com.shequan.demo.dao.DemoDAO.selectUserByUserNameAndUserPwd",record);
	}

	public DemoUserInfo selectUserByUserName(DemoUserInfo record) {
		return (DemoUserInfo)getSqlSession().selectOne("com.shequan.demo.dao.DemoDAO.selectUserByUserName",record);
	}
}
